package xjtu.se.articlecommunity.admin.login.impl;


import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xjtu.se.articlecommunity.admin.login.dto.Mail;
import xjtu.se.articlecommunity.admin.login.dto.Tel;
import xjtu.se.articlecommunity.admin.login.AdminLoginService;
import xjtu.se.articlecommunity.admin.login.dao.AdminLoginDao;
import xjtu.se.articlecommunity.admin.login.dto.Admin;

import javax.annotation.Resource;

@Service
@Transactional
public class AdminLoginServiceImpl implements AdminLoginService {

    @Resource
    private AdminLoginDao loginDao;

    @Override
    public boolean loginByPwd(Admin admin) {
        return loginDao.loginByPwd(admin) > 0;
    }

    @Override
    public boolean checkMail(String mail) {
        return loginDao.checkMail(mail) > 0;
    }

    @Override
    public Admin getInfoByMail(Mail mail) {
        return loginDao.getInfoByMail(mail);
    }

    @Override
    public boolean checkTel(String tel) {
        return loginDao.checkTel(tel);
    }

    @Override
    public Admin getInfoByTel(Tel tel) {
        return loginDao.getInfoByTel(tel);
    }

}
